![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@rocicorp/lock
Advanced tools
Provides Lock
and RWLock
(read write lock) synchronization primitives for
protecting in-memory state across multiple tasks and/or microtasks.
npm install @rocicorp/lock
Lock
is a mutex that can be used to synchronize access to a shared resource.
import {Lock} from '@rocicorp/lock';
const lock = new Lock();
async function f(n) {
const v = await lock.withLock(async () => {
await sleep(1000);
return n;
});
console.log(n);
}
void f(1);
void f(2);
// prints 1 at t=1000
// prints 2 at t=2000
RWLock
is a read write lock. There can be mutlipe readers at the same time but only one writer at the same time.
import {RWLock} from '@rocicorp/lock';
const rwLock = new RWLock();
async function read(n) {
const v = await lock.withRead(async () => {
await sleep(1000);
return n;
});
console.log('read', n);
}
async function write(n) {
const v = await lock.withWrite(async () => {
await sleep(1000);
return n;
});
console.log('write', n);
}
void read(1);
void write(2);
void read(3);
// prints read 1 at t=1000
// prints read 3 at t=1000
// prints write 2 at t=2000
Both Lock
and RWLock
expose non "with" methods (lock
, read
and write
). These returns a promise to a release function that resolves when the lock is acquired. This is useful when you cannot wrap your code in a function like the examples above. When using these For example:
const lock = new Lock();
const release = await lock.lock();
// here we got the lock
// do something
release();
FAQs
Implements Lock and RWLock synchronization primitives.
The npm package @rocicorp/lock receives a total of 8,484 weekly downloads. As such, @rocicorp/lock popularity was classified as popular.
We found that @rocicorp/lock demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.